<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>模版数据管理 HDSysCms</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link rel="stylesheet" href="<?php echo getcdnurlhost() ?>/admin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="<?php echo getcdnurlhost() ?>/admin/style/admin.css" media="all">
</head>
<body data="HDSYSCMS 2021本系统受国家版权局保护请勿破解或者二次开发传播">
<div class="layui-fluid1">
<div class="layui-row layui-col-space151">
<div class="layui-col-md12">
<div class="layui-card">
<div style="position: fixed;z-index: 999;background-color: #fff;width: 100%;box-shadow: 0px 1px 5px #2e8cee33;" class="layui-tab layui-tab-brief" lay-filter="component-tabs-hash">
<ul class="layui-tab-title">
<li class="layui-this" lay-id="hdsysatable">动态标签</li>
</ul>
<div style="overflow-y: scroll;height: calc(100vh - 73px);" class="layui-tab-content layui-card-body1">
<div class="layui-tab-item layui-show">
<table style="padding-top: 100px;" lay-skin="line" lay-size="lg" class="layui-table" lay-even="test-table-toolbar" id="test-table-toolbar" lay-filter="test-table-toolbar"></table>
<script type="text/html" id="test-table-toolbar-barDemo"><div><div class="MHover MHover-x"><a class="layui-btn layui-btn" lay-event="edit"><i class="layui-icon">&#xe642;</i>保存修改</a></div></div></script>
<script type="text/html" id="test"><div>{{# if(d.type=='img' || d.type=='val-img'){ }}<div class="img-box"><div class="divimg"><img id="imges{{d.id}}" src="{{d.src}}" /><button title="鼠标右键点击更多图片上传选项" data-id="{{d.id}}" lay-event="imges" data-type="upimges" class="button-simges layui-btn layui-btn-sm MHover ">选择图片</button></div><div class="inputs"><div class="layui-form-item"><label class="layui-form-label">图片</label><div style="width: calc(100% - 300px);min-width: 190px;" class="layui-input-inline"><input type="text" id="value{{d.id}}" value="{{d.src}}" placeholder="连接地址/Base64编码" class="layui-input"></div><div class="layui-form-mid layui-word-aux">图片</div></div><div class="layui-form-item"><label class="layui-form-label">描述alt描述</label><div style="width: calc(100% - 300px);min-width: 190px;" class="layui-input-inline"><input type="text" id="alt{{d.id}}" value="{{d.alt}}" placeholder="连接描述" class="layui-input"></div><div class="layui-form-mid layui-word-aux">图片描述有利SEO</div></div></div></div>{{# }else if(d.type=='val-a'){ }}<div class="layui-form-item"><label style="width: 89px;" class="layui-form-label">连接地址</label><div style="width: calc(100% - 300px);min-width: 190px;" class="layui-input-inline"><input type="text" id="src{{d.id}}" value="{{d.src}}" placeholder="连接地址" class="layui-input"></div><div class="layui-form-mid layui-word-aux">跳转的连接地址 </div></div><div class="layui-form-item"><label style="width: 89px;" class="layui-form-label">连接标题</label><div style=" width: calc(100% - 300px);min-width: 190px;" class="layui-input-inline"><input type="text" id="value{{d.id}}" value="{{d.text}}" placeholder="连接标题" class="layui-input"></div><div class="layui-form-mid layui-word-aux">连接标题显示标题</div></div>{{# }else if(d.type=='val-value'){ }}<div class="img-box">{{#if(d.act=='upfile-img'){ }}<div class="divimg"><img id="imges{{d.id}}" src="{{d.tmp_val}}" /><button title="鼠标右键点击更多图片上传选项" data-id="{{d.id}}" lay-event="imges" name="imges" data-type="upimges" class="button-simges layui-btn layui-btn-sm MHover ">选择图片</button></div>{{# } }}<div style=" width: 100%" class="value-box">{{# if(d.act=='upfile-img'){ }}<label class="layui-form-label">图片</label>{{# } }}<div style="display: flex; width: 100%;align-items: center;" class="layui-form-item"><div style=" width: calc(100% - 100px);min-width: 190px;" class="layui-input-inline"><input type="text" id="value{{d.id}}" value="{{d.val}}" placeholder="单行内容" class="layui-input"></div><div id="{{d.act}}{{d.id}}" class="{{d.act}}{{d.id}} layui-form-mid layui-word-aux">{{#if(d.act=='upfile-img'){ }}图片地址,网络图片,Base64图片{{# }else{ }}请输入名称内容{{# } }}</div></div></div></div>{{# }else{ }}<textarea id="value{{d.id}}" class="layui-textarea textarea">{{d.text}}</textarea>{{# } }}</div></script>
<script type="text/html" id="showname"><div>{{# if(d.name=='undefined' || d.name=='' || d.name==undefined){ }}<div title="{{d.id}}"><span title="{{d.id}}" class="texts-sm">{{d.id}}</span></div>{{# }else{ }}<div title="{{d.id}}"><span title="{{d.id}}" class="texts-sm">{{d.name}}</span></div>{{# } }}</div></script>
<div id="setimges-up"></div>
</div>
</div>
</div>
</div>
</div>
</div>
<?php adminechohtnl(); ?>
<script src="<?php echo getcdnurlhost() ?>/admin/layui/layui.js"></script>
<script src="<?php echo getcdnurlhost() ?>/jquery.min.js"></script>
<script>var value_ID='';layui.config({base: '<?php echo getcdnurlhost() ?>/admin/'}).extend({index: 'lib/index'}).use(['jquery', 'index', 'dropdown', 'colorpicker', 'element', 'table', 'form', 'upload', 'layer'], function() {var admin=layui.admin,$=layui.$,form=layui.form,colorpicker=layui.colorpicker,element=layui.element,upload=layui.upload,dropdown=layui.dropdown,table=layui.table;table.render({elem: '#test-table-toolbar',url: 'index.php?m=<?php echo set_get('m'); ?>&c=<?php echo set_get('c'); ?>&a=<?php echo set_get('a'); ?>_ajax&json=get&soso_ok=1&id=<?php echo set_get('id'); ?>&dir=<?php echo set_get('dir'); ?>&file=<?php echo set_get('file'); ?>&div_id=<?php echo set_get('div_id'); ?>',toolbar: false,skin: 'line',title: '动态标签列表',height: "full",groups: 1,first: false,last: false,cols: [[{field: 'name',width: 200,title: '',templet: '#showname',}, {field: 'text',minwidth: 200,title: '',templet: '#test'}, {title: '',toolbar: '#test-table-toolbar-barDemo',width: 250}]],page: false,done: function(res, curr, count) {if (res.code !=-1) {Object.keys(res.data).forEach((key, index)=> {console.log(key, res.data[key].act);if (res.data[key].act=='color') {colorpicker.render({elem: '#' + res.data[key].act + res.data[key].id,format: 'rgb',alpha: true,predefine: true,color: res.data[key].val,change: function(color) {$("#value" + res.data[key].id).val(color);}});}});}dropdown.render({elem: '.button-simges',trigger: 'contextmenu',show: true,data: [{title: '原图尺寸上传 (Base64)',id: 0,base64: '1'},{title: '720宽高自动',id: 720,base64: '0'}, {title: '960宽高自动 ',id: 960,base64: '0'}, {title: '1200宽高自动',id: 1200,base64: '0'}, {title: '1980宽高自动',id: 1980,base64: '0'}, {title: '720宽高自动 (Base64)',id: 720,base64: '1'}, {title: '960宽高自动 (Base64)',id: 960,base64: '1'}, {title: '1200宽高自动 (Base64)',id: 1200,base64: '1'}, {title: '1980宽高自动 (Base64)',id: 1980,base64: '1'}],click: function(obj) {value_ID=$(this.elem).attr('data-id');uploadInst.reload({url: 'index.php?m=manage&c=UpFile&a=UpTemplates&filename=' + value_ID + '&newwidth=' + obj.id + "&base64=" + obj.base64});$('#setimges-up').click();}});}});var uploadInst=upload.render({elem: '#setimges-up',url: 'index.php?m=manage&c=UpFile&a=UpTemplates&filename=',choose: function(obj) {},before: function(obj) {layer.load(0);},done: function(res) {layer.closeAll();if (res.code==-1) {return layer.msg(res.msg);}$('#value' + value_ID).val(res.url);try {$('#imges' + value_ID).attr('src', res.tmp_url);} catch (e) {};layer.msg('图片上传成功,点击保存按钮保存模版数据');},error: function() {layer.closeAll();layer.alert('上传失败');}});table.on('tool(test-table-toolbar)', function(obj) {var data=obj.data;var that=this;if (obj.event==='imges') {value_ID=$(this).attr('data-id');uploadInst.reload({url: 'index.php?m=manage&c=UpFile&a=UpTemplates&filename=' + value_ID + '&newwidth=0&base64=0'});$('#setimges-up').click();} else if (obj.event==='edit') {console.log(data);value_ID="#value" + data.id;var data_edit=encodeURIComponent($(value_ID).val());value_ID="#src" + data.id;var data_src=encodeURIComponent($(value_ID).val());value_ID="#alt" + data.id;var data_alt=encodeURIComponent($(value_ID).val());$.ajax({type: "post",url: 'index.php?m=manage&c=<?php echo set_get('c') ?>&a=age_edit_ajax&dir=<?php echo set_get('dir') ?>&id=<?php echo set_get('id') ?>&file=<?php echo set_get('file') ?>',data: 'div_text=' + data_edit + '&div_src=' + data_src + '&div_alt=' + data_alt + '&div_id=' + data.id + '&type=' + data.type,dataType: "json",success: function(ret) {if (ret.code==1) {if (top.document.getElementById('iframe') !=null) {top.document.getElementById('iframe').contentWindow.location.reload();layer.msg(ret.msg);} else {layer.msg(ret.msg + ",刷新后显示.");}} else {layer.msg(ret.msg);}},error: function(e, t) {layer.alert('接口请求返还异常');}});};});});</script>
<style>.templetimg {width: 90px;height: 60px;}.layui-card-body1 {padding: 10px 15px;line-height: 24px;padding-top: 50px;}.texts-sm {display: flex;align-content: center;justify-content: center;align-items: center;height: 85px;}.layui-table-body .layui-table-cell {height: 85px;}.layui-table {width: 100% !important;}.MHover {opacity: 0;}.MHover-x {display: flex;align-content: center;justify-content: center;align-items: center;height: 85px;}.layui-table-click .MHover,.layui-table-hover .MHover {opacity: 1;}.layui-table,.layui-table-view {margin: 5px 0;}.layui-table-header table {display: none;}.hdsys-mode-iframe {position: absolute;width: 100%;height: 100%;left: 0;top: 45px;right: 0;bottom: 0;}.textarea {min-height: 50px;width: 100%;height: 85px;border: 1px solid #b7b6b6;padding: 5px;font-size: 12px;}.divimg img {height: 85px;background-color: #1b84ed;background-image: linear-gradient(144deg, #0080ff, #FFF);padding: 1px;min-width: 60px;}.img-box {display: flex;}.inputs {width: 100%;}.layui-form-item {margin-bottom: 5px;clear: both;}.value-box {display: flex;align-items: center;height: 85px;}.layui-colorpicker {width: 61px;height: 39px;border: 1px solid #eee;padding: 5px;border-radius: -16px;line-height: 24px;display: inline-block;cursor: pointer;transition: all .3s;-webkit-transition: all .3s;margin-top: 2px;}</style>
</body>
</html>